package com.wskj.common.serialize;

import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase;

import java.util.Objects;

public class NullToStringSerialize  extends ToStringSerializerBase {

    public static final ToStringSerializer instance = new ToStringSerializer();

    public NullToStringSerialize() {
        super(Object.class);
    }

    public NullToStringSerialize(Class<?> handledType) {
        super(handledType);
    }

    public final String valueToString(Object value) {
        if(Objects.isNull(value)){
            return "";
        }
        return value.toString();
    }
}



